package com.ice.test.user;

import com.ice.test.slice.demo.HelloPrx;
import com.zeroc.Ice.Communicator;
import com.zeroc.Ice.ObjectPrx;
import com.zeroc.Ice.Util;

import java.util.logging.Logger;

public class Client {
    private static Logger logger = Logger.getLogger(Client.class.getSimpleName());

    public static void main(String[] args) {
        logger.info("客户端启动.........");

        //初始化通信器
        Communicator ic = Util.initialize(args);

        // 根据地址生成一个服务代理对象
        // HelloIce -- 服务端那边自己定义的名字
        ObjectPrx proxy = ic.stringToProxy("HelloIce:default -h 192.168.10.1 -p 1888");
        // 转换成HelloService类型的代理服务
        HelloPrx helloPrx = HelloPrx.checkedCast(proxy);
        //调用服务器端的方法
        String s = helloPrx.sayHello("The World");
        System.out.println(">>"+s);
    }
}
